package com.example.demo.breakrulemanage.controller;

import com.example.demo.breakrulemanage.service.BreakRuleService;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@Transactional
@CrossOrigin
public class BreakRuleController {

    private Logger log = Logger.getLogger(BreakRuleController.class);

    @Autowired
    private BreakRuleService breakRuleService;

    /**
         * @Description 新增违章记录
         * @Author zhangxue
         * @Date 11:18 2018/7/12
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/saveBreakRule",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> saveBreakRule(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = breakRuleService.saveBreakRule(param);
        return statusMap;
    }

    /**
     * @Description 处理违章记录
     * @Author zhangxue
     * @Date 11:18 2018/7/12
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/editBreakRule",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> editBreakRule(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = breakRuleService.editBreakRule(param);
        return statusMap;
    }

    /**
     * @Description 删除违章记录
     * @Author zhangxue
     * @Date 11:18 2018/7/12
     * @Param
     * @retrun
     **/
    @RequestMapping(value="/delBreakRule",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> delBreakRule(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = breakRuleService.delBreakRule(param);
        return statusMap;
    }

    /**
         * @Description 查询所有违章记录
         * @Author zhangxue
         * @Date 10:59 2018/11/13
         * @Param
         * @retrun
         **/
    @RequestMapping(value="/queryAllBreakRule",method = RequestMethod.POST,produces = "application/json;charset=utf-8")
    @ResponseBody
    public Map<String,Object> queryAllBreakRule(@RequestBody Map<String,Object> param){
        Map<String,Object> statusMap = breakRuleService.queryAllBreakRule(param);
        return statusMap;
    }

}
